package com.sgb.kjwl.view.ui.adapter.self.mine;

import android.content.Context;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.sgb.capital.view.widget.BaseRecyclerViewAdapterHelper.BaseQuickAdapter;
import com.sgb.capital.view.widget.BaseRecyclerViewAdapterHelper.viewholder.BaseViewHolder;
import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.self.TeamPerson;
import com.sgb.kjwl.model.entity.user.PriceListEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class TeamAuthAdapter extends BaseQuickAdapter<TeamPerson, BaseViewHolder> {
    private EditPerson editPerson;

    public TeamAuthAdapter(int layoutResId, @Nullable List<TeamPerson> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, TeamPerson item) {
          holder.getView(R.id.del).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  editPerson.onDelClick(holder.getPosition());
              }
          });
        EditText name = holder.getView(R.id.name);
        EditText phone = holder.getView(R.id.phone);
        EditText zhuanye = holder.getView(R.id.zhuanye);
        EditText minzu = holder.getView(R.id.minzu);
        EditText jiguan = holder.getView(R.id.jiguan);
        TextView shengri =holder.getView(R.id.shengri);
        holder.setText(R.id.number,"("+(holder.getPosition()+1)+(")"));
            name.setText(item.getName());
            phone.setText(item.getPhone());
            zhuanye.setText(item.getMajor());
            minzu.setText(item.getNation());
            jiguan.setText(item.getDomicile());
            if (item.getBirthDate()!=null){
                shengri.setText(item.getBirthDate());
            }else {
                shengri.setText("");
            }
//        name.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                 editPerson.onnameClick(holder.getPosition());
//            }
//        });
//            phone.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    editPerson.onphoneClick(holder.getPosition());
//                }
//            });
//            zhuanye.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    editPerson.onzhuanyeClick(holder.getPosition());
//                }
//            });
//            minzu.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    editPerson.onminzuClick(holder.getPosition());
//                }
//            });
//            jiguan.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    editPerson.onjiguanClick(holder.getPosition());
//                }
//            });
        shengri.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               editPerson.onBorhtdayClick(holder.getPosition());
           }
       });

    }
    public void setOnEditePersonclicke(EditPerson editPerson){
      this.editPerson =editPerson;
    }
    public interface EditPerson{
        void onDelClick(int pos);
        void onBorhtdayClick(int pos);
//        void onnameClick(int pos);
//        void onphoneClick(int pos);
//        void onzhuanyeClick(int pos);
//        void onminzuClick(int pos);
//        void onjiguanClick(int pos);
    }
}
